package com.fingard.dsp.bank.reqrespobj.virtual;

import com.fingard.constant.Format;
import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RequestBase;
import com.fingard.text.StringHelper;
import com.fingard.xml.XmlTextReader;

import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;

public class ReqQueryVirtualOrder extends RequestBase{

    /**
     * 己方账号
     */
    public String ownAct = "";

    /**
     * 虚拟户编号
     */
    public String virtualAccount = "";

    /**
     * 商户订单号
     */
	public String rdSeq;

    /**
     * 开始日期
     */
    public String bgnDate;

    /**
     * 结束日期
     */
	public String endDate;

	/**
	 * 交易方向(1-支出2-收入)
	 */
	public String moneyWay;

	/**
	 * 交易金额
	 */
	public String amount;

	public Date getDateFrom() throws ParseException {
		return Format.Date8Format.parse(bgnDate);
	}

	public Date getDateTo() throws ParseException {
		return Format.Date8Format.parse(endDate);
	}

	public ReqQueryVirtualOrder(HashMap<String,String> p_hashMap, ReqRespHeader p_header) throws Exception{
		reqHeader = p_header;

		if(p_hashMap.containsKey("OurBankAccount")){
			ownAct = p_hashMap.get("OurBankAccount");
			if(ownAct == null){
				ownAct = "";
			}
		}

		if(p_hashMap.containsKey("RdSeq")){
			rdSeq = p_hashMap.get("RdSeq");
		}

        if(p_hashMap.containsKey("VirtualAccount")){
            virtualAccount = p_hashMap.get("VirtualAccount");
        }

		if(p_hashMap.containsKey("BgnDate")){
			bgnDate = p_hashMap.get("BgnDate");
		}

        if(p_hashMap.containsKey("EndDate")){
            endDate = p_hashMap.get("EndDate");
        }

		if (p_hashMap.containsKey("MoneyWay")) {
			moneyWay = p_hashMap.get("MoneyWay");
		}

		if (p_hashMap.containsKey("Amount")) {
			amount = p_hashMap.get("Amount");
		}
	}
}
